import request from "./request";
import jquest from './jsonrequest'


//验证手机号是否注册过
export const VerificatPhone = (params: any) => {
    return request.post('/user/docheckphone', params)
}

//注册
export const AdminReg = (params: any) => {
    return request.post('/user/dofinishregister', params)
}

//登录
export const AdminLogin = (params: any) => {
    return request.post('/user/login', params)
}

//发送验证码
export const SendSms = (params: any) => {
    return request.post('/user/dosendmsgcode', params)
}

//获取轮播图
export const GetBannerList = () => {
    return request.get('/banner/list')
}

//产品的分类列表
export const cateGoryList = () => {
    return request.get('/pro/categorylist')
}

export const GetSearchList = (params: any) => {
    return request.get(`/pro/search?count=${params.count}&limitNum=${params.limitNum}&keyword=${params.keyword}`)
}

// 产品分类下品牌列表
export const categoryBrandList = (params: string) => {
    return request.get(`/pro/categorybrandlist?category=${params}`)
}

// 获取某分类下某品牌的产品列表
export const categoryBrandproList = (params: any) => {
    return request.get(`/pro/categorybrandprolist?count=${params.count}&limitNum=${params.limitNum}&category=${params.category}&brand=${params.brand}`)
}

//获取商品分页列表数据
export const getProList = (params: any) => {
    return request.get(
        `/pro/list?count=${params.count}&limitNum=${params.limitNum}`
    );
};

//获取秒杀产品列表
export const GetseckillList = () => {
    return request.get('/pro/seckilllist')
}

//查看购物车
export const GetCarList = (params: any) => {
    return request.post('/cart/list', params)
}

//更新购物车数量
export const UpdateCart = (params: any) => {
    return request.post('/cart/updatenum', params)
}

//删除购物车单条数据
export const RemoveCarPro = (params: any) => {
    return request.post('/cart/remove', params)
}

//获取产品的详情数据
export const GetPromsg = (params: any) => {
    return request.get(`/pro/detail/${params}`)
}

//加入购物车
export const ProCartAdd = (params: any) => {
    return request.post('/cart/add', params)
}

//删除当前用户购物车数据
export const RemoveAllCar = (params: any) => {
    return request.post('cart/removeall', params)
}

//新增地址
export const AddAdress = (params: any) => {
    return request.post('/address/add', params)
}

//删除地址
export const DeleteAddress = (params: any) => {
    return request.post('/address/delete', params)
}


//获取用户地址
export const GetUserAds = (params: any) => {
    return request.get(`/address/list?userid=${params.userid}`)
}

//查询默认地址
export const GetDefaultAds = (params: any) => {
    return request.post('/address/defaultAddress', params)
}

//更新当前购物车数据的选中状态
export const CartSelectone = (params: any) => {
    return request.post('/cart/selectone', params)
}

//更新所有购物车数据的选中状态
export const CartSelectall = (params: any) => {
    return request.post('/cart/selectall', params)
}

//添加订单
export const Addorder = (params: any) => {
    return request.post('/order/addOrder', params)
}


//确认订单信息
export const ConfirmOrder = (params: any) => {
    return request.get(`/order/confirmOrder?userid=${params.userid}&time=${params.time}`)
}

//查看全部订单
export const Orderlist = (params: any) => {
    return request.get(`/user/orderlist?userid=${params.userid}`)
}
//支付时删除购物车选中的数据
export const DeleteCarItem = (params: any) => {
    return request.get(`/order/deleteCartItem?userid=${params.userid}`)
}

//查看评论列表
export const getComon = () => {
    return jquest.get('/comon')
}

//更新评论
export const AddComon = (params: any) => {
    return jquest.post('/comon', params)
}